<template>
    <h1>页面bBBBBBBBBBBBBBBBB</h1>
    <div style="width: 400px;margin:auto">
        <a-form-item label="邮箱地址">
            <a-input v-model:value="username"/>
        </a-form-item>
        <a-form-item label="密码">
            <a-input v-model:value="password"/>
        </a-form-item>
        <a-button @click="create">注册</a-button>
    </div>
</template>

<script>
import {message} from "ant-design-vue";
import axios from "axios";

export default {
    name: "PageB",
    data() {
        return {
            username: 'yaclty@qq.com',
            password: '123123',
            code: '983584',
            sendLoading: false,
            saveLoading: false
        }
    },
    methods: {
        create() {
            this.saveLoading = true
            axios.post('http://localhost:9001/user/create', {
                username: this.username,
                password: this.password,
                code: this.code
            })
                .then(function (response) {
                    const result = response.data;
                    if (result.code == 0) {
                        message.info("注册成功", 5)
                    } else {
                        message.error("注册失败:" + result.message, 5)
                    }
                })
                .catch(function (e) {
                    message.error(e.message, 5)
                })
                .finally(() => this.saveLoading = false)
        }
    }
}
</script>

<style scoped>

</style>